home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcoop.arc / TCOOP2.ARC / MSOUNIT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-26  |  3.1 KB  |  109 lines

  1. // msounit.h: Menu screen object (mso) class definitions
  2.  
  3. #ifndef H_MSOUNIT
  4. #define H_MSOUNIT
  5.  
  6. // Conditional directives used to determine which files 
  7. // should be included 
  8.  
  9. #ifdef GRAPHICS
  10. #include "gwsounit.h"
  11. #else
  12. #include "twsounit.h"
  13. #endif
  14.  
  15. typedef void (*ActionProc)(Wso *Src, MsgPkt &M);
  16.  
  17. // --------- Generic menu entry screen object type --------- 
  18.  
  19. class Meso : public Wso {
  20. public:
  21.  char Name[40];      // Menu entry label
  22.  ActionProc Action;  // The action assigned to the entry
  23.  Meso *Next;         // References the next menu entry 
  24.  Meso(char *N, ActionProc A);
  25.  virtual void Draw(void);
  26.  virtual void Prompt(void);
  27.  virtual void UnPrompt(void);
  28.  virtual void OnKeyStroke(MsgPkt &M); 
  29.  virtual void OnClose(MsgPkt &M); 
  30.  virtual void Activate(MsgPkt &M); 
  31. };
  32.  
  33. class MesoList { // A circular list for storing menu entries
  34. public: 
  35.   Meso *Last;     // Referencs last menu entry on list
  36.   MesoList(void);
  37.   virtual ~MesoList(void);
  38.   virtual void Append(Meso *Me); 
  39. };
  40.  
  41. class Mso : public Wso {     // The menu screen object type 
  42. public:
  43.   MesoList *Entries;         // The list of menu entries 
  44.   Meso *CurrSeln;            // The selected menu entry
  45.   int EntriesDrawn;          // "Entries have been drawn" flag
  46.   int Nrows, Ncols, Spacing; // Menu dimensions
  47.   Mso(MesoList *El, int Nc, int Nr, int Sp, int W, int H,
  48.       int Bd, int Fa, ColorPak &Cp);
  49.   virtual void SetupDim(int &Nc, int &Nr, int &W, int &H); 
  50.   virtual int EntryWidth(Meso *Me);
  51.   virtual void SetupEntries(void);
  52.   virtual int  IsHz(void) { return Nrows == 1; }
  53.   virtual int  IsVt(void) { return Ncols == 1; }
  54.   virtual void Open(Iso *B, int X, int Y);
  55.   virtual void MoveLoop(MsgPkt &M);
  56.   virtual void Activate(MsgPkt &M);
  57.   virtual void Leave(MsgPkt &M);
  58.   virtual void OnKeyStroke(MsgPkt &M);
  59.   virtual void Forw(MsgPkt &M);
  60.   virtual void Back(MsgPkt &M);
  61. };
  62.  
  63. // ------ Types used to support pull-down menu systems ------ 
  64.  
  65. // This type is used to create a pull-down menu bar 
  66.  
  67. class PullDnBar : public Mso {
  68. public:
  69.   Mso *SubMso;
  70.   PullDnBar(MesoList *Items, int W, int Sp, ColorPak &Cp);
  71.   virtual void OnKeyStroke(MsgPkt &M); 
  72. };
  73.  
  74. // This type is used to create a pull-down menu system 
  75.  
  76. class Pmso : public Wso {
  77. public:
  78.   PullDnBar *Bar;       // The pull-down menu bar
  79.   Wso *Inner;           // The window region for the menu system
  80.   Pmso(MesoList *Items, int W, int H, int Sp,
  81.        int Ba, int Fa, ColorPak &Cp);
  82.   virtual void Open(Iso *B, int X, int Y);
  83. };
  84.  
  85. // This type is used to create an entry for the pull-down menu bar 
  86.  
  87. class Dmso; // Forward reference
  88.  
  89. class Pmeso : public Meso {
  90. public:
  91.  Dmso *Vm; // The drop menu assigned to the menu entry
  92.  Pmeso(char *N, Dmso *D);
  93.  virtual void SwitchFocus(MsgPkt &M);
  94.  virtual void OnKeyStroke(MsgPkt &M);
  95. };
  96.  
  97. // This type is used to create a drop menu 
  98.  
  99. class Dmso : public Mso {
  100. public:
  101.   Pmeso *Parent; // The top-level menu that the drop menu 
  102.                  // is assigned to 
  103.   Dmso(MesoList *Items, int W, int Ba, int Fa, ColorPak &Cp);
  104.   virtual void OnClose(MsgPkt &M);
  105.   virtual void OnKeyStroke(MsgPkt &M);
  106. };
  107.  
  108. #endif
  109.